#ifndef DRAW_H
#define DRAW_H

const double PI = 3.1415926 ;

float randreal() ;
void drawcircle(float x, float y, float z, float radius);
void drawsphere(float x, float y, float z, float radius);
//void prepare_color(std::vector<Face *> & faces); 
struct color_RGB
{
	color_RGB(float _r, float _g, float _b):r(_r),g(_g),b(_b) {}
	color_RGB():r(1.0),g(1.0),b(1.0) {}
	float r, g, b;
};

struct STATES
{
STATES()
{
	sample_points = false;
	selected_face_idx = 0; 
}
	bool sample_points ; /*Controled by key 'S'*/
	unsigned selected_face_idx ;
};
class Point 
{
public:
	Point () {}
	Point (float a, float b, float c)
	{
		x = a; y = b; z = c;
	}
	float x, y, z;
	friend float operator * (const Point & lhs, const Point & rhs)
	{
		return (lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z);
	}
	friend Point operator + (const Point & lhs, const Point & rhs)
	{
		return Point (lhs.x + rhs.x , lhs.y + rhs.y , lhs.z + rhs.z);
	}
	friend Point operator / (const Point & lhs, float rhs)
	{
		return Point (lhs.x / rhs, lhs.y / rhs, lhs.z / rhs);
	}
	friend Point operator * (const Point & lhs, float rhs)
	{
		return Point (lhs.x * rhs, lhs.y * rhs, lhs.z * rhs);
	}
	friend Point operator - (Point & lhs, Point & rhs)
	{
		return Point (lhs.x - rhs.x , lhs.y - rhs.y , lhs.z - rhs.z);
	}
	friend Point operator ^ (const Point & lhs, const Point & rhs) 
	{
		return Point (lhs.y * rhs.z - lhs.z * rhs.y, 
					lhs.z * rhs.x - lhs.x * rhs.z,
					lhs.x * rhs.y - lhs.y * rhs.x );
	}
	static Point normal (const Point & p)
	{
		float length = sqrt (p.x * p.x + p.y * p.y + p.z * p.z);
		return Point (p.x /length, p.y /length, p.z /length);
	}
};

class Resolution 
{
public:
	Resolution():reso(1) {}


private:
	unsigned reso ; 
	//std::vector<std::vector<color_RGB> > color_array; 
};
void getGLVersion(int * major, int * minor) ;
void getGLSLVerstion(int * major, int * minor) ;
#endif
